package com.my.core.domain.log;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * @author timo 2021/2/25
 */
@Data
public class LogAbstract implements Serializable {
    protected static final long serialVersionUID = 1L;
    @JsonSerialize(
            using = ToStringSerializer.class
    )
//    @TableId(
//            value = "id",
//            type = IdType.ASSIGN_ID
//    )
    protected Long id;
    private String tenantId;
    protected String serviceId;
    protected String serverIp;
    protected String serverHost;
    protected String env;
    protected String remoteIp;
    protected String userAgent;
    protected String requestUri;
    protected String method;
    protected String methodClass;
    protected String methodName;
    protected String params;
    protected String createBy;
    @DateTimeFormat(
            pattern = "yyyy-MM-dd HH:mm:ss"
    )
    @JsonFormat(
            pattern = "yyyy-MM-dd HH:mm:ss"
    )
    protected Date createTime;

    public LogAbstract() {
    }

    @Override
    public String toString() {
        return "LogAbstract(id=" + this.getId() + ", tenantId=" + this.getTenantId() + ", serviceId=" + this.getServiceId() + ", serverIp=" + this.getServerIp() + ", serverHost=" + this.getServerHost() + ", env=" + this.getEnv() + ", remoteIp=" + this.getRemoteIp() + ", userAgent=" + this.getUserAgent() + ", requestUri=" + this.getRequestUri() + ", method=" + this.getMethod() + ", methodClass=" + this.getMethodClass() + ", methodName=" + this.getMethodName() + ", params=" + this.getParams() + ", createBy=" + this.getCreateBy() + ", createTime=" + this.getCreateTime() + ")";
    }
}
